/**
 * 
 */
package br.com.rodolfo.timesheet.service;

import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import br.com.rodolfo.timesheet.dao.CargoDAO;
import br.com.rodolfo.timesheet.entity.Cargo;

/**
 * @author rjulio
 *
 */
@Service("cargoService")
public class CargoService {

	@Autowired
	private CargoDAO dao;

	public List<Cargo> findAll() {
		List<Cargo> lista = new ArrayList<Cargo>();
		
		for(int i = 0;i<9;i++){
			Cargo cargo = new Cargo();
			cargo.setDescricao("Cargo"+i);
			cargo.setId(i);
			cargo.setPerfil(null);
			cargo.setValorhora(new BigDecimal(i*Math.random()));
			lista.add(cargo);
		}
		return lista;

	}

	public Object findByName(String value) throws SQLException {
		return dao.findByName(value);
	}
}
